package com.iflytek.sbd.demo.springflowtest;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;

/**
 * @program: springbootdemo
 * @description:
 * @author: 陈英俊
 * @create: 2021-12-23 09:50
 */
@Configuration
public class AppleConfig {
    /**
     * DependsOn 注解会让当前bean依赖的bean,比当前的bean先自动创建出来
     *
     * @return
     */

    @Bean(name = "apple",initMethod = "init",destroyMethod = "destroy1")
   // @DependsOn(value = {"getBanana"})
    public Apple apple() {
        Apple apple = new Apple();
        apple.setName("陈亮");
        return apple;
    }


//    @Bean
//    public Banana getBanana() {
//  //     System.out.println("开始newBanana方法");
//        return new Banana();
//    }
}
